package com.xdjd.mobile.business.dao.daoservice.member;

import com.xdjd.mobile.business.dao.mapper.member.MemberUserStepPoDao;
import com.xdjd.mobile.business.entity.model.member.MemberUserStepPo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * Created by Administrator on 2019/1/9 0009.
 */
@Service
public class MemberUserStepPoService {

    @Autowired
    private MemberUserStepPoDao memberUserStepPoDao;

    public void saveUserStep(MemberUserStepPo po){
        po.setCreateTime(new Date());
        po.setModifyTime(new Date());
        memberUserStepPoDao.save(po);
    }

    public MemberUserStepPo findStepByMemberId(Long memberId) {
        return memberUserStepPoDao.getByProperty("member_id", memberId);
    }

    public int updateStepNumber(Long memberId, Long stepNumber) {
        return memberUserStepPoDao.updateStepNumber(memberId, stepNumber);
    }

    public int addChanceCountLock(Long memberId) {
        return memberUserStepPoDao.addChanceCountLock(memberId);
    }

    public int reduceDefaultChanceCountLock(Long memberId){
        return memberUserStepPoDao.reduceDefaultChanceCountLock(memberId);
    }

    public int reduceChanceCountLock(Long memberId){
        return memberUserStepPoDao.reduceChanceCountLock(memberId);
    }
}
